# Linux
#!/usr/bin/python3
# Windows
#!C:\Python37\python.exe

# 注释1
# 注释2

'''
块注释1
'''

"""
块注释2
"""

print("Hello, World!")

# 缩进：Table
# 条件判断
if True:
	print("True")
else:
	print("False")

# 数字(Number)类型
print(1)
print(True)
print(False)
print(1.1)
print(1E-2)
print(1+2j)
print(3.1+2.2j)

# 字符串
str1 = "this is a test.\nDo you like this?"
print("str1=\n" + str1)

str2 = r"this is a test.\nDo you like this?"
print("str2=\n" + str2)

str3 = """
line 1
line 2
line 3 \n
line4
"""
print("str3=\n" + str3)


str4 = r"""
line 1
line 2
line 3 \n
line4
"""
print("str4=\n" + str4)

# 级联字符串
str5 = "this" "is" "test"
print("str5=\n" + str5)

# + 连接
str6 = "this" + "is" + "test"
print("str6=\n" + str6)

# * 号 重复
str7 = "this" * 3
print("str7=\n" + str7)

# * 号 小数 重复
# TypeError: can't multiply sequence by non-int of type 'float'
#str8 = "this" * 3.5
#print("str7=\n" + str8)

str9 = "Worth nearly $1trn, Facebook is the world’s sixth-most-valuable company."
print("str9=\n" + str9)
print(str9[0])
print(str9[0:7])
print(str9[0:0])
print(str9[0:-1]) # 少一个点
print(str9[0:-10])
print(str9[-1:-10])

# 等待用户输入
input("\n\n按下 Enter 键后退出")

# 一行多条语句
# import 居然可以出现在这里！
import sys;x='multiple行';sys.stdout.write(x);


# print不换行
print("1")
print("2")
print("3")
print("4")
print("print不换行：end=\" \"")
print("1", end=" ")
print("2", end=" ")
print("3", end=" ")
print("4", end=" ")

# 导入
import sys
print(sys)
print("命令行参数：")
# 执行：sys.argv 是一个数组
for i in sys.argv:
	print(i)
print("\nPython的路径为：", sys.path) # sys.path也是一个数组

from sys import argv,path
print('mode: from somemodule import somefunction')
print(argv)
print(path)



